import 'package:ladder_cash/app/com/service/burial_point_service.dart';
import 'package:ladder_cash/app/page/component/common.dart';
import 'package:ladder_cash/app/page/component/decoration_bg.dart';
import 'package:ladder_cash/config/super_theme.dart';
import 'package:ladder_cash/generated/l10n.dart';
import 'package:ladder_cash/value/app_lstyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/view/loading_view.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_style.dart';

import '../../../Global.dart';
import '../../../gen/assets.gen.dart';
import '../../../library/src/logger.dart';
import '../../comm_key_def.dart';
import 'authentication_logic.dart';

class QuestionnaireSurveyPage extends StatefulWidget {
  QuestionnaireSurveyPage({super.key});

  @override
  _AuthenticationPageState createState() => _AuthenticationPageState();
}

class _AuthenticationPageState extends State<QuestionnaireSurveyPage> {
  final logic = Get.find<AuthenticationLogic>();

  @override
  void initState() {
    super.initState();
    BurialPointService.start(BPoint.questionnaire);
  }
 /// 问卷调查
  @override
  Widget build(BuildContext context) {
    return LoadingView(
        isPullDown: true,
        future: () => logic.getQuestionnaireSurveyInfo(),
        datas: logic.authenticationInfo,
        onSuccess: () {
          if (logic.authenticationInfo != null) logic.update();
        },
        body: () => Column(children: [
          Expanded(child: Container(
            padding: EdgeInsets.only(top: 14.w,bottom: 10.w),
            margin: EdgeInsets.all(12.w),
            width: Global.width,
            decoration:  BoxDecoration(
                image: getDecorationBg(Assets.home.homeQBg.path),
                borderRadius: getTopRadius()),
            child: LFlexV(
              [middleFont(S.current.pleaseFollow,fontsize: 26.sp),logic.chooseList(type: CommKeyDef.credit), ]

            ),
          )),
          confirmBtn
        ],));
  }

  get confirmBtn => Column(children: [
        LSizeBoxHeight(16.w),
        Container(
          height: 53.w,
          padding: EdgeInsets.symmetric(horizontal:  16.w),
          child: commonBtn(S.current.next, callback: () {
            logic.saveQuestionnaireSurvey();
          }),
        ),
        LSizeBoxHeight(42.w)
      ]);
}
